<div class="page-content">
    <!-- BEGIN PAGE HEADER-->
	<div class="row">
		<div class="col-md-12">
			<!-- BEGIN PAGE TITLE & BREADCRUMB-->
			<h3 class="page-title">
		          Edit Composition
			</h3>
			<ul class="page-breadcrumb breadcrumb">
				<li>
					<i class="fa fa-home"></i>
					<a href="<?php echo $this->Admin->admin_url() ?>">
						Home
					</a>
					<i class="fa fa-angle-right"></i>
				</li>
				<li>
					<a href="<?php echo $this->Admin->admin_url() ?>composition/index">
						Composition list
					</a>
					<i class="fa fa-angle-right"></i>
				</li>
				<li>
					<a href="javascript:void(0)">
						Edit Composition
					</a>
				</li>
			</ul>
			<!-- END PAGE TITLE & BREADCRUMB-->
		</div>
	</div>
	<!-- END PAGE HEADER-->
	<!-- BEGIN PAGE CONTENT-->
    <div class="row">
        <div class="col-md-12">
        	<!-- BEGIN VALIDATION STATES-->
        	<div class="portlet box blue">
        		<div class="portlet-title">
        			<div class="caption">
        				<i class="fa fa-reorder"></i>Managed_table
        			</div>
        		</div>
        		<div class="portlet-body form">
        			<!-- BEGIN FORM-->
        			<!--form action="" id="form_category" class="form-horizontal" method="post"-->
                    <?php
                        echo $this->Form->create('Composition', array(
                                                            'url' => array('controller' => 'composition', 'action' => 'edit', $compo_id), 
                                                            'type' => 'post',
                                                            'id' => 'form_composition',
                                                            'class' => 'form-horizontal'));
                    ?>
        				<div class="form-body">
                            <div class="form-group">
                                <label class="control-label col-md-3" for="type">Group
                                <span class="required">
        							 *
        						</span>
                                </label>
                                <div class="col-md-4 error_category">
            					<?php
                                    $types = array('cutkit' => 'CUT KIT', 'hsth' => 'HOA SI TI HON');
                                    echo $this->Form->select('group', $types, 
                                                            array(
                                                                'class' => 'form-control',
                                                                'id' => 'group',
                                                                'empty' => 'Choice group',
                                                                'default' => $compo_info['vn']['group']
                                                            )
                                    );
                                ?>
                                </div>
            				</div>
                            <div class="form-group">
        						<label class="control-label col-md-3">Sort order
                                 </label>
        						<div class="col-md-4">
                                    <?php
                                        echo $this->Form->text('sort_order',
                                                        array(
                                                            'label' => false,
                                                            'div' => false,
                                                            'class' => 'form-control',
                                                            'value' => $compo_info['vn']['sort_order']
                                                        )
                                        );
                                    ?>
        						</div>
        					</div>
                            <div class="form-group">
        						<label class="control-label col-md-3"></label>
        						<div class="col-md-9">
                        			<div class="tabbable tabbable-custom">
                        				<ul class="nav nav-tabs">
                                            <?php
                                                $i=0;
                                                foreach($list_language as $language)
                                                {
                                                    $language = $language['language'];
                                                    $lang_code = $language['lang_code'];
                                            ?>
                        					<li class='<?php echo $i++==0 ? "active" : "" ?>'>
                        						<a data-toggle="tab" href="#tab_<?php echo $lang_code ?>">
                        							 <img src="<?php echo $this->webroot; ?>admin/img/flags/<?php echo $lang_code ?>.png" />
                                                     <?php echo $language['title'] ?>
                        						</a>
                        					</li>
                                            <?php
                                                }
                                            ?>
                        				</ul>
                        				<div class="tab-content">
                                            <?php
                                                $i = 0;
                                                foreach($list_language as $language)
                                                {
                                                    $language = $language['language'];
                                                    $lang_code = $language['lang_code'];
                                            ?>
                                            <div id="tab_<?php echo $lang_code ?>" class="tab-pane <?php echo $i++==0 ? "active" : "" ?>">
                                                <div class="form-group">
                            						<label class="control-label mgl15">Title
                                                        <span class="required">*</span>
                            						</label>
                            						<div class="col-md-12 error-title">
                            							<?php
                                                        /*
                                                            echo $this->Form->input('title_'.$lang_code,
                                                                            array(
                                                                                'label' => false,
                                                                                'div' => false,
                                                                                'class' => 'form-control',
                                                                                'value' => $compo_info[$lang_code]['title'],
                                                                            )
                                                            );
                                                        */
                                                        ?>
                                                        <input type="text" id="title_<?php echo $lang_code ?>" required="required" class="form-control" name="data[Composition][title_<?php echo $lang_code ?>]" value="<?php echo $compo_info[$lang_code]['title'] ?>"/>
                            						</div>
                            					</div>
                                                <!--END_INPUT_FORM-->
                                                <div class="form-group">
                            						<label class="control-label mgl15">
                                                        Short description
                            						</label>
                            						<div class="col-md-12">
                            							<?php
                                                            echo $this->Form->textarea('description_'.$lang_code, array('class' => 'form-control', 'rows' => '6', 'value' => $compo_info[$lang_code]['description']));
                                                        ?>
                            						</div>
                            					</div>
                                                <!--END_INPUT_FORM-->
                                                <div class="clearfix"></div>
                        					</div>
                        					<!--end tab-pane-->
                                            <?php
                                                }
                                            ?>
                        					<!--end tab-pane-->
                                            <div class="clearfix"></div>
                        				</div>
                                        
                        			</div>
                        		</div>
        					</div>
                            <div class="clearfix"></div>
        				</div>
        				<div class="form-actions fluid">
        					<div class="col-md-offset-3 col-md-9">
                                <button type="submit" class="btn blue" name="btn_submit" value="ok">Submit</button>
        						<button type="button" class="btn default" onclick="window.location.href='<?php echo $this->Admin->admin_url() ?>composition/index'">Cancel</button>
        					</div>
        				</div>
                        
        			<?php echo $this->Form->end(); ?>
        			<!-- END FORM-->
        		</div>
        		<!-- END VALIDATION STATES-->
        	</div>
        </div>
    </div>
</div>       
<!-- END CONTENT -->
<script type="text/javascript" src="<?php echo $this->webroot; ?>ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>ckfinder/ckfinder.js"></script>
<script>
    <?php
        foreach($list_language as $language)
        {
            $language = $language['language'];
            $lang_code = $language['lang_code'];
    ?>
        var description_<?php echo $lang_code ?> = CKEDITOR.replace('data[Composition][description_<?php echo $lang_code ?>]');
        CKFinder.setupCKEditor( description_<?php echo $lang_code ?>, '<?php echo $this->webroot ?>ckfinder/' );
    <?php
        }
    ?>
</script>
